{% extends "base.html" %}
{% block title %}Start{% endblock %}
{% block content %}
<div class="content">
            <p class="content-note1">修改物资请购信息<span class="content-note2"> (标注为*为必填项)</span></p>
            <div style="clear:both"></div>
            <form class="form-table" action="{% url 'changedetail' %}" method="post">
                <input type="hidden" id="assetid" name="assetid" value="{{ asset.id }}"/>
                <div class="form-list">
                    <span>是否完成</span>
                    <select name="Finish" {% if assetForm.errors.Finish %}class="input-error"{% endif %}>
                        <option value="已完成" {% ifequal tempasset.Finish '已完成' %}selected{% endifequal %}>已完成</option>
                        <option value="未完成" {% ifequal tempasset.Finish '未完成' %}selected{% endifequal %}>未完成</option>
                    </select>
                </div>
                <div class="form-list">
                    <span>需求来源</span><input {% if assetForm.errors.Source %}class="input-error"{% endif %} type="text" name="Source" value="{{ tempasset.Source }}" placeholder="不超过30个字符"/>
                </div>
                <div class="form-list">
                    <span>单据号</span><input {% if assetForm.errors.Document_No %}class="input-error"{% endif %} type="text" name="Document_No" value="{{ tempasset.Document_No }}" placeholder="不超过50个字符"/>
                </div>
                <div class="form-list">
                    <span>采购订单号</span><input {% if assetForm.errors.Order_No %}class="input-error"{% endif %} type="text" name="Order_No" value="{{ tempasset.Order_No }}" placeholder="不超过50个字符"/>
                </div>
                <div class="form-list">
                    <span>请购日期</span><input {% if assetForm.errors.Requisition_date %}class="input-error"{% endif %} type="text" name="Requisition_date" value="{{ tempasset.Requisition_date }}" placeholder="不超过50个字符"/>
                </div>
                <div class="form-list">
                    <span>请购物资/固定资产</span><input {% if assetForm.errors.Materials %}class="input-error"{% endif %} type="text" name="Materials" value="{{ tempasset.Materials }}" placeholder="不超过300个字符"/>
                </div>
                <div class="form-list">
                    <span>请购部门</span><input {% if assetForm.errors.Department %}class="input-error"{% endif %} type="text" name="Department" value="{{ tempasset.Department }}" placeholder="不超过50个字符"/>
                </div>
                <div class="form-list">
                    <span>请购人</span><input {% if assetForm.errors.Requisitioner %}class="input-error"{% endif %} type="text" name="Requisitioner" value="{{ tempasset.Requisitioner }}" placeholder="不超过30个字符"/>
                </div>
                <div class="form-list">
                    <span>请购数量</span><input {% if assetForm.errors.Requisition_Num %}class="input-error"{% endif %} type="text" name="Requisition_Num" value="{{ tempasset.Requisition_Num }}" placeholder="不超过20个字符"/>
                </div>
                <div class="form-list">
                    <span>请购用途</span><input  {% if assetForm.errors.Requisition_purpose %}class="input-error"{% endif %} type="text"name="Requisition_purpose" value="{{ tempasset.Requisition_purpose }}" placeholder="不超过300个字符">
                </div>
                <div class="form-list">
                    <span>采购订单生成时间</span><input  {% if assetForm.errors.Order_Time %}class="input-error"{% endif %} type="text" name="Order_Time" value="{{ tempasset.Order_Time }}" placeholder="不超过50个字符">
                </div>
                <div class="form-list">
                    <span>采购员</span><input  {% if assetForm.errors.Purchaser %}class="input-error"{% endif %} type="text" name="Purchaser" value="{{ tempasset.Purchaser }}" placeholder="不超过30个字符">
                <div class="form-list">
                    <span>超长原因说明</span><input  {% if assetForm.errors.Reason %}class="input-error"{% endif %} type="text" name="Reason" value="{{ tempasset.Reason }}" placeholder="不超过300个字符">
                </div>
                <div class="form-list">
                    <span>供应商</span><input  {% if assetForm.errors.Supplier %}class="input-error"{% endif %} type="text" name="Supplier" value="{{ tempasset.Supplier }}" placeholder="不超过100个字符">
                </div>
                <div class="form-list">
                    <span>预计到货时间（采购回复）</span><input  {% if assetForm.errors.Arrival_time1 %}class="input-error"{% endif %} type="text" name="Arrival_time1" value="{{ tempasset.Arrival_time1 }}" placeholder="不超过50个字符">
                </div>
                <div class="form-list">
                    <span>预计到货时间（供应商回复）</span><input  {% if assetForm.errors.Arrival_time2 %}class="input-error"{% endif %} type="text" name="Arrival_time2" value="{{ tempasset.Arrival_time2 }}" placeholder="不超过50个字符">
                </div>
                <div class="form-list">
                    <span>实际到货时间（一）</span><input  {% if assetForm.errors.Actual_time1 %}class="input-error"{% endif %} type="text" name="Actual_time1" value="{{ tempasset.Actual_time1 }}" placeholder="不超过50个字符">
                </div>
                <div class="form-list">
                    <span>实际到货数量（一）</span><input  {% if assetForm.errors.Actual_Num1 %}class="input-error"{% endif %} type="text" name="Actual_Num1" value="{{ tempasset.Actual_Num1 }}" placeholder="不超过20个字符">
                </div>
                <div class="form-list">
                    <span>实际到货时间（二）</span><input  {% if assetForm.errors.Actual_time2 %}class="input-error"{% endif %} type="text" name="Actual_time2" value="{{ tempasset.Actual_time2 }}" placeholder="不超过50个字符">
                </div>
                <div class="form-list">
                    <span>实际到货数量（二）</span><input  {% if assetForm.errors.Actual_Num2 %}class="input-error"{% endif %} type="text" name="Actual_Num2" value="{{ tempasset.Actual_Num2 }}" placeholder="不超过20个字符">
                </div>
                <div class="form-list">
                    <span>实际到货时间（三）</span><input  {% if assetForm.errors.Actual_time3 %}class="input-error"{% endif %} type="text" name="Actual_time3" value="{{ tempasset.Actual_time3 }}" placeholder="不超过50个字符">
                </div>
                <div class="form-list">
                    <span>实际到货数量（三）</span><input  {% if assetForm.errors.Actual_Num3 %}class="input-error"{% endif %} type="text" name="Actual_Num3" value="{{ tempasset.Actual_Num3 }}" placeholder="不超过20个字符">
                </div>
                <div class="form-list">
                    <span>未到数量</span><input  {% if assetForm.errors.Unarrival_Num %}class="input-error"{% endif %} type="text" name="Unarrival_Num" value="{{ tempasset.Unarrival_Num }}" placeholder="不超过20个字符">
                </div>
                <div class="form-list">
                    <span>是否超期</span>
                    <select name="Overdue" {% if assetForm.errors.Finish %}class="input-error"{% endif %}>
                        <option value="已超期" {% ifequal tempasset.Overdue '已超期' %}selected{% endifequal %}>已超期</option>
                        <option value="未超期" {% ifequal tempasset.Overdue '未超期' %}selected{% endifequal %}>未超期</option>
                    </select>
                </div>
                <div class="form-list">
                    <span>超期时间</span><input  {% if assetForm.errors.Overdue_time %}class="input-error"{% endif %} type="text" name="Overdue_time" value="{{ tempasset.Overdue_time }}" placeholder="不超过20个字符">
                </div>
                <div class="form-list">
                    <span>备注</span><input  {% if assetForm.errors.Remarks %}class="input-error"{% endif %} type="text" name="Remarks" value="{{ tempasset.Remarks }}" placeholder="不超过300个字符">
                </div>
                {% if msg %}
                    <div class="error">{{ msg }}</div>
                {% endif %}
                <div style="clear:both"></div>
                <div class="form-list">
                    <input class="form-button" type="submit" value="保存"/>
                </div>
                <div class="form-list">
                     <button class="form-button" type="button" onclick="btn_cancel()">取消</button>
                </div>
                <div class="form-list">
                     <button class="form-button form-button-del" type="button" onclick="btn_delete()">删除</button>
                </div>
                {% csrf_token %}
            </form>
        </div>    
{% endblock %}
{% block custome_js %}
    <script>
        function btn_cancel() {
            location.href = "{% url 'servers:server_list' %}";
        }

        function btn_delete() {
            var server_id = document.getElementById("server_id").value;
            var url = "{% url 'servers:server_delete' 0 %}";
            var conf = confirm("确定删掉该条数据？");
            if (conf){
                location.href = url.replace('0', server_id);
            }
        }
        var sidebar = document.getElementById("sidebar");
        var content_height = document.body.scrollHeight>window.innerHeight?document.body.scrollHeight-48:window.innerHeight-48;
        sidebar.style.height = content_height+'px';
    </script>
{% endblock %}